package com.ncut.api.client;

import com.ncut.dto.GoodsSalesDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @FileName TradeClient
 * @Description
 * @Author Sword
 * @date 2025-08-10
 **/
@FeignClient(value = "trade-service")
public interface TradeClient {

    /**
     * 根据map查询营业额
     *
     * @param map
     * @return
     */
    @GetMapping("/admin/order/sum")
    Double sumByMap(@RequestParam Map<String, Object> map);

    /**
     * 查询销量排名top10
     *
     * @param beginTime
     * @param endTime
     * @return
     */
    @GetMapping("/admin/order/salesTop10")
    List<GoodsSalesDTO> getSalesTop10(@RequestParam LocalDateTime beginTime, @RequestParam LocalDateTime endTime);

    /**
     * 统计订单数量
     * @param map
     * @return
     */
    @GetMapping("/admin/order/count")
    Integer countByMap(@RequestParam Map<String, Object> map);
}
